package com.shop.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shop.po.dto.OrderDetailInfo;
import com.shop.user.po.OrderDetail;
import org.apache.ibatis.annotations.*;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author banxia
 * @since 2023-02-25
 */
public interface OrderDetailMapper extends BaseMapper<OrderDetail> {


    List<OrderDetailInfo> merchantGetOrderInfo(@Param("merchantId") Long merchantId,
                                               @Param("state") String state,
                                               @Param("page") Long page,
                                               @Param("size") Long size);

    Long merchantGetTotal(@Param("merchantId") Long merchantId,
                          @Param("state") String state);

    @Update("update order_detail set state=#{state} where id=#{orderDetailsId}")
    void changState(@Param("state") String state,
                    @Param("orderDetailsId") String orderDetailsId);

    @Update("update order_detail set state=#{state} where order_id=#{orderId}")
    void updateState(@Param("orderId") Long orderId,
                     @Param("state") String state);
}
